package dao;

import bean.Student;

import java.sql.ResultSet;
import java.sql.SQLException;
public class Studentdao extends Basedao {
    public Student login(String stuid, String password) {
        String sql = "select * from student where stuid = '" + stuid + "' and password = '" + password + "'";
        ResultSet resultSet = query(sql);
        try {
            if (resultSet.next()) {
                Student student = new Student();
                student.setsid(resultSet.getString("stuid"));
                student.setPassword(resultSet.getString("password"));
                return student;
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}
